import type { Rectangle, Size } from "./utils/common"

const zhTranslations = {
  panels: {
    layers: { title: "图层" },
    history: { title: "历史" },
    metadata: { title: "元数据" }
  },
  canvasActions: {
    file: "文件",
    edit: "编辑",
    layers: "图层",
    init: "新建图像",
    addLayer: "添加图层",
    applyShape: "应用形状",
    deselect: "取消选择",
    addCapturedArea: {
      rectangle: "矩形选择"
    },
    transformShape: {
      capturedRectangle: "变换矩形"
    },

    duplicateLayer: "复制图层",
    mergeLayerDown: "向下合并图层",
    hideLayer: "隐藏图层",
    showLayer: "显示图层",
    moveLayerDown: "下移图层",
    moveLayerUp: "上移图层",
    removeLayer: "删除图层",
    selectLayer: "选择图层",
    cutCapturedArea: "剪切选择",
    cropCanvas: "裁剪画布",
    resizeCanvas: "调整画布大小"
  },
  adjustments: {
    name: "调整",
    grayscale: { name: "灰度" },
    sepia: { name: "复古" }
  },
  models: {
    name: "模型",
    prompt: "提示",
    labelObjects: {
      name: "标记对象",
      result: {
        noObjects: "未检测到对象"
      }
    },
    removeBackground: {
      name: "移除背景"
    },
    chat: {
      name: "聊天"
    },
    textToImage: { name: "文本转图像" },
    imageToImage: { name: "图像转图像" },
    smartCrop: {
      name: "智能裁剪",
      result: {
        noObjects: "未检测到对象"
      }
    },
    errors: {
      429: "超出速率限制",
      401: "API 密钥无效",
      403: "API 密钥未授权",
      500: "内部服务器错误",
      default: "处理请求失败"
    },
    options: {
      size: "大小",
      steps: "步骤",
      imageStrength: "图像强度",
      quality: {
        name: "质量",
        standard: "标准",
        high: "高"
      }
    },
    config: {
      server: "服务器"
    }
  },
  shapesTransform: {
    "generated-image": {
      add: "生成图像",
      transform: "变换图像",
      apply: "应用图像"
    },
    "dropped-image": {
      add: "拖放图像",
      transform: "变换图像",
      apply: "应用图像"
    },
    "captured-rectangle": {
      add: "选择矩形",
      transform: "变换选择",
      apply: "应用选择"
    },
    "captured-area": {
      add: "选择区域",
      transform: "变换区域",
      apply: "应用区域"
    },
    "drawn-rectangle": {
      add: "绘制矩形",
      transform: "变换矩形",
      apply: "应用矩形"
    },
    "drawn-ellipse": {
      add: "绘制椭圆",
      transform: "变换椭圆",
      apply: "应用椭圆"
    }
  },
  tools: {
    rectangleSelect: {
      name: "矩形选择"
    },
    magicWandSelect: {
      name: "魔术棒选择",
      settings: {
        tolerance: "容差"
      }
    },
    shapeDraw: {
      name: "形状",
      settings: {
        type: {
          name: "形状",
          options: {
            rectangle: "矩形",
            ellipse: "椭圆"
          }
        },
        fillColor: "填充",
        strokeColor: "描边",
        strokeWidth: "描边宽度"
      }
    },
    brushDraw: {
      name: "画笔",
      settings: {
        color: "颜色",
        size: "大小"
      }
    },
    pencilDraw: {
      name: "铅笔",
      settings: {
        color: "颜色"
      }
    },
    eraserDraw: {
      name: "橡皮擦",
      settings: {
        size: "大小"
      }
    },
    fillDraw: {
      name: "填充",
      settings: {
        color: "颜色",
        tolerance: "容差"
      }
    },
    sprayDraw: {
      name: "刷漆",
      settings: {
        color: "颜色",
        range: "范围",
        density: "密度"
      }
    }
  },
  alerts: {
    clearData: {
      title: "清除数据",
      message: `您确定要清除所有存储的数据吗？这将删除：

•	工作区和图像
•	设置
•	API 密钥

此操作无法撤消。`,
      confirm: "清除"
    }
  },
  chat: {
    welcomeMessage: "你好！我是您的创意助手。我如何帮助您处理图像？",
    errors: {
      noModels: "没有可用的聊天模型。转到设置以添加一些。"
    },
    suggestions: ["这张图片中有什么对象？", "为这张图片建议一个滤镜。", "建议图像增强。"]
  },
  dialogs: {
    settings: {
      title: "设置",
      tabs: {
        general: {
          title: "常规"
        },
        models: {
          title: "AI 模型",
          addModel: "添加模型",
          message: "使用 API 密钥的模型需要桌面版本进行安全存储"
        }
      }
    },
    welcome: {
      pages: {
        welcome: {
          title: "欢迎",
          message: "你好！欢迎来到 CNC Master。让我们配置一些设置，以便开始您的创意之旅。"
        },
        theme: {
          title: "主题",
          message: "设置您喜欢的主题。我可以适应系统主题，或者您可以选择明亮或黑暗。"
        },
        models: {
          title: "模型",
          message:
            "我可以使用各种 AI 模型来帮助您。这是默认列表，但您可以添加自己的模型。API 密钥模型仅适用于桌面。查看文档了解自托管。"
        }
      }
    },
    editWorkspace: {
      title: "编辑工作区",
      fields: {
        name: "名称",
        size: "大小",
        background: {
          name: "背景",
          title: "背景颜色",
          options: {
            none: "无",
            solid: "纯色"
          }
        }
      }
    },
    createWorkspace: {
      title: "新建工作区",
      fields: {
        name: "名称",
        size: "大小",
        background: {
          name: "背景",
          title: "背景颜色",
          options: {
            none: "无",
            solid: "纯色"
          }
        }
      }
    },
    cropCanvas: {
      title: "裁剪画布",
      types: {
        percentage: "百分比",
        absolute: "绝对",
        offset: "偏移"
      },
      printCrop: (crop: Rectangle) => `裁剪 x: ${crop.x}, y: ${crop.y}, 宽度: ${crop.width}, 高度: ${crop.height}`,
      errors: {
        tooSmall: "裁剪区域太小",
        outOfBounds: "裁剪区域超出边界"
      }
    },
    resizeCanvas: {
      title: "调整画布大小",
      types: {
        percentage: "百分比",
        absolute: "绝对"
      },
      printSize: (size: Size) => `宽度: ${size.width}, 高度: ${size.height}`,
      errors: {
        tooBig: "画布尺寸太大",
        tooSmall: "画布尺寸太小"
      }
    },
    imageToImage: {
      title: "图像转图像",
      defaultPrompt: "背后有日落的美丽风景",
      errors: {
        layerIsEmpty: "图层为空"
      }
    },
    removeBackground: {
      title: "移除背景",
      errors: {
        layerIsEmpty: "图层为空"
      }
    },
    textToImage: {
      title: "文本转图像",
      defaultPrompt: "戴帽子的猫"
    }
  },
  themes: {
    light: "亮",
    dark: "暗",
    system: "系统"
  },
  commandPalette: {
    placeholder: "输入命令或搜索...",
    noResults: "未找到结果"
  },
  commands: {
    clearActiveWorkspace: "清除工作区",
    closeActiveWorkspace: "关闭工作区",
    createActiveWorkspace: "新建工作区",
    openCropCanvasDialog: "裁剪画布",
    openResizeCanvasDialog: "调整画布大小",
    openSettingsDialog: "打开设置",
    fitCanvasToWindow: "适应窗口",
    openCommandPalette: "打开命令面板",
    openChatPopup: "打开聊天",
    openFile: "打开文件",
    redoCanvasAction: "重做画布操作",
    undoCanvasAction: "撤销画布操作",
    editWorkspace: "编辑工作区",
    editLayer: "编辑图层",
    resetLayout: "重置布局",
    saveAsJpeg: "另存为 JPEG",
    saveAsPng: "另存为 PNG",
    saveAsWorkspace: "保存工作区 (PDW)",
    shareWorkspace: "分享工作区 (PNG)",
    addLayer: "添加图层",
    removeLayer: "删除图层",
    moveLayerUp: "上移图层",
    moveLayerDown: "下移图层",
    duplicateLayer: "复制图层",
    mergeLayerDown: "向下合并图层",
    hideLayer: "隐藏图层",
    showLayer: "显示图层",
    pasteImage: "粘贴图像",
    copyImage: "复制图像",
    cutImage: "剪切图像",
    checkForUpdate: "检查更新",
    dropFiles: {
      createNewWorkspace: "创建新工作区",
      addNewLayer: "粘贴到新图层",
      pasteOntoActiveLayer: "粘贴到活动图层"
    }
  },
  layers: {
    defaultBaseName: "背景",
    defaultNewName: (index: number) => `图层 ${index}`,
    defaultCopyName: (name: string) => `${name} 复制`
  },
  workspace: {
    defaultName: "无标题"
  },
  general: {
    models: "模型",
    remove: "删除",
    anchor: "锚点",
    apply: "应用",
    cancel: "取消",
    clear: "清除",
    close: "关闭",
    create: "创建",
    edit: "编辑",
    color: "颜色",
    continue: "继续",
    download: "下载",
    favorite: "收藏",
    generate: "生成",
    height: "高度",
    heightPercentage: "高度 (%)",
    images: "图像",
    loading: "加载中",
    name: "名称",
    next: "下一个",
    offsets: "偏移",
    previous: "上一个",
    process: "处理",
    recent: "最近",
    regenerate: "重新生成",
    resize: "调整大小",
    result: "结果",
    secret: "密钥 (API Key)",
    theme: "主题",
    unknown: "未知",
    update: "更新",
    untitled: "无标题",
    width: "宽度",
    widthPercentage: "宽度 (%)"
  },
  color: {
    hex: "十六进制",
    rgba: {
      r: "红",
      g: "绿",
      b: "蓝",
      a: "透明度"
    }
  },
  info: {
    noModels: "未配置模型"
  },
  errors: {
    noFilesDropped: "未拖放文件。不支持文件类型。",
    noImageData: "没有图像数据",
    processingError: "处理错误",
    copyClipboardError: "复制到剪贴板错误。不支持此操作。",
    sharingNotSupported: "此设备不支持或不允许共享"
  },
  updater: {
    updatedTo: (version: string) => `应用程序已更新到版本 ${version}`,
    available: "有更新可用",
    downloading: "正在下载更新",
    notAvailable: "没有可用的更新",
    installed: "更新已安装",
    installedAndRestart: "重新启动以应用更改",
    restart: "重新启动",
    install: "安装",
    notifyDesktop: "尝试桌面应用程序以获取自定义 AI 模型"
  },
  links: {
    help: "帮助",
    reportIssue: "报告问题",
    viewSource: "查看源代码"
  }
}

export const getTranslations = () => zhTranslations
